/*
 * DBAdminService
 * 
 */
package edu.depaul.se.courseregistration.webservice;

import edu.depaul.se.courseregistration.jpa.courses.College;
import edu.depaul.se.courseregistration.jpa.courses.Course;
import edu.depaul.se.courseregistration.jpa.courses.Section;
import edu.depaul.se.courseregistration.jpa.courses.Subject;
import edu.depaul.se.courseregistration.sessionbean.DBAdminSession;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

/**
 *
 * @author pbondare
 */
//@WebService(serviceName = "DBAdminService")
@Stateless()
public class DBAdminService {

   @EJB
    private DBAdminSession dbAdminSession; 
   
   //Create Course
   @WebMethod(operationName = "CreateCourse")
    public Course CreateCourse(
    @WebParam (name = "subjectCode") int subjectid,
    @WebParam (name = "courseId") int courseId,
    @WebParam (name = "courseTitle") String courseTitle,  
    @WebParam (name = "coursePreprequisite") String coursePrerequisite, 
    @WebParam (name = "courseBrief") String courseBrief, 
    @WebParam (name = "quarterNumber") int quarterNumber, 
    @WebParam (name = "termTitle") String termTitle,
    @WebParam (name = "termYear") String termYear
    ) { 
        return dbAdminSession.createCourse(subjectid, courseId, courseTitle, coursePrerequisite, 
                                           courseBrief, quarterNumber,termTitle, termYear);
   }
   
   @WebMethod(operationName = "RemoveCourse")
    public void RemoveCourse(@WebParam (name = "courseNumber") int courseNumber) {
        dbAdminSession.removeCourse(courseNumber);
   }
   
   @WebMethod(operationName = "UpdateCourse")
    public void UpdateCourse(@WebParam (name = "courseID") int courseID,
    @WebParam (name = "courseTitle") String courseTitle,  
    @WebParam (name = "coursePreprequisite") String coursePrerequisite, 
    @WebParam (name = "courseBrief") String courseBrief, 
    @WebParam (name = "quarterNumber") int quarterNumber, 
    @WebParam (name = "termTitle") String termTitle,
    @WebParam (name = "termYear") String termYear
    ) {
       dbAdminSession.updateCourse(courseID, courseTitle, coursePrerequisite, courseBrief, 
               quarterNumber,termTitle, termYear);
   }
   
   //Create Section
   @WebMethod(operationName = "CreateSection")
    public Section CreateSection(@WebParam (name = "courseID") int courseID, 
    @WebParam (name = "sectionId") int sectionId,  
    @WebParam (name = "sectionPrice") int sectionPrice, 
     @WebParam (name = "isOpen") boolean isOpen,
     @WebParam (name = "instructorName") String instructorName, 
     @WebParam (name = "sectionDates") String sectionDates, 
     @WebParam (name = "meetingHours") String meetingHours, 
     @WebParam (name = "buildingName") String buildingName,     
     @WebParam (name = "roomNumber") String roomNumber
    ) {     
       
       return dbAdminSession.createSection(courseID,  sectionId, sectionPrice,  isOpen, instructorName,
                                           sectionDates,  meetingHours,  buildingName,  roomNumber);
   } 
   //Remove Section
   @WebMethod(operationName = "RemoveSection")
    public void RemoveSection(@WebParam (name = "courseSectionID") int courseSectionID) {
        dbAdminSession.removeSection(courseSectionID);
   }
   //Update Section
   @WebMethod(operationName = "UpdateSection")
    public void UpdateSection(@WebParam (name = "sectionID") int sectionID,
    @WebParam (name = "sectionPrice") int sectionPrice, 
    @WebParam (name = "isOpen") boolean isOpen,
    @WebParam (name = "instructorName") String instructorName, 
    @WebParam (name = "sectionDates") String sectionDates, 
    @WebParam (name = "meetingHours") String meetingHours, 
    @WebParam (name = "buildingName") String buildingName,     
    @WebParam (name = "roomNumber") String roomNumber       
    ) {
       dbAdminSession.updateSection(sectionID, sectionPrice,  isOpen, instructorName,
                                    sectionDates,  meetingHours,  buildingName,  roomNumber);
   }

   
   //Create Subject
   @WebMethod(operationName = "CreateSubject")
    public Subject CreateSubject(@WebParam (name = "collegeID") int collegeID, 
    @WebParam (name = "subjectid") int subjectid,  
    @WebParam (name = "subjectCode") String subjectCode, 
    @WebParam (name = "subjectDescription") String subjectDescription
    ) {        
                
        return dbAdminSession.createSubject(collegeID, subjectCode, subjectDescription, subjectid);
   } 
   //Remove Subject
   @WebMethod(operationName = "RemoveSubject")
    public void RemoveSubject(@WebParam (name = "subjectID") int subjectID) {
        dbAdminSession.removeSubject(subjectID);
   } 
   //Update Subject
   @WebMethod(operationName = "UpdateSubject")
    public void UpdateSubject(@WebParam (name = "subjectID") int subjectID, 
     @WebParam (name = "subjectCode") String subjectCode, 
     @WebParam (name = "subjectDescription") String subjectDescription
     ) {          
        dbAdminSession.updateSubject(subjectID, subjectCode, subjectDescription);
   }
   
   
   //Create College
   @WebMethod(operationName = "CreateCollege")
    public College CreateCollege(@WebParam (name = "collegeID") int collegeID, @WebParam (name = "collegeName") String collegeName, 
    @WebParam (name = "collegeShortName") String collegeShortName 
    ) {      
       
       return dbAdminSession.createCollege(collegeID,collegeName, collegeShortName);
   } 
   
   //Remove College
   @WebMethod(operationName = "RemoveCollege")
    public void RemoveCollege(@WebParam (name = "collegeId") int collegeId) {
        dbAdminSession.removeCollege(collegeId);
   } 
   
   //Update College
   @WebMethod(operationName = "UpdateCollege")
    public void UpdateCollege(@WebParam (name = "collegeID") int collegeID,
    @WebParam (name = "collegeName") String collegeName, 
    @WebParam (name = "collegeShortName") String collegeShortName 
    ) {
       dbAdminSession.updateCollege(collegeID, collegeName, collegeShortName);
   }
   
}
